/*
 * Copyright (c) 2005, 2014 vacoor
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */
Ext.define('Nothing.store.Modules', {
    extend: 'Ext.data.Store',
    uses: ['Nothing.ux.data.writer.Form'],  //TODO

    model: 'Nothing.model.Module',

    proxy: {
        defaultWriterType: 'form',  // TODO 等待服务器端容易处理json(包含批量json create/update)时候废弃
        type: 'ajax',
        reader: {
            readRecordsOnFailure: false,
            successProperty: 'success', // 只有当 === false || === 'false' 才认为false
            messageProperty: 'message',
            totalProperty: 'recordCount',
            root: 'data'
        },

        api: {
            read: 'modules/list',
            create: 'modules/create',
            update: 'modules/update',
            destroy: 'modules/delete'
        },

        headers: {
            'Accept': 'application/json'
        },
        extraParams: {}
    }
});
